From 3f394a6b337d02a2939415cbf52e5cde915a106d Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Fri, 4 Sep 2009 08:43:05 +0100 Subject: [PATCH] x86: Fix PoD cache size when decreasing memory Certain paths through p2m_pod_decrease_reservation() fail to reduce the size of the PoD cache if the number of outstanding entries is less than the size of the cache. Rearrange so this doesn't happen. Signed-off-by: George Dunlap --- xen/arch/x86/mm/p2m.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/xen/arch/x86/mm/p2m.c b/xen/arch/x86/mm/p2m.c index c10b31b566..511f35718f 100644 --- a/xen/arch/x86/mm/p2m.c +++ b/xen/arch/x86/mm/p2m.c @@ -634,7 +634,7 @@ p2m_pod_decrease_reservation(struct domain *d, p2md->pod.entry_count-=(1<pod.entry_count < 0); ret = 1; - goto out_unlock; + goto out_entry_check; } /* FIXME: Steal contig 2-meg regions for cache */ @@ -678,6 +678,12 @@ p2m_pod_decrease_reservation(struct domain *d, } } + /* If there are no more non-PoD entries, tell decrease_reservation() that + * there's nothing left to do. */ + if ( nonpod == 0 ) + ret = 1; + +out_entry_check: /* If we've reduced our "liabilities" beyond our "assets", free some */ if ( p2md->pod.entry_count < p2md->pod.count ) { @@ -685,11 +691,6 @@ p2m_pod_decrease_reservation(struct domain *d, p2m_pod_set_cache_target(d, p2md->pod.entry_count); } - /* If there are no more non-PoD entries, tell decrease_reservation() that - * there's nothing left to do. */ - if ( nonpod == 0 ) - ret = 1; - out_unlock: audit_p2m(d); p2m_unlock(p2md); -- 2.30.2